package app.kernel.api;

// Written by: Ng Wen Long
public class Query {

	public String destinatedAddress;
	public String querySignature;
	public String queryString;
	public String requestorAddress;
	public String CSG_Name;
	public String SCName;
	public int TTL = 50;
	
	public Query(String CSG_Name, String SCName,String destination, String signature, String QueryString, String requestor, int TTL){		
		destinatedAddress = destination;
		querySignature = signature;
		queryString = QueryString;
		requestorAddress = requestor;
		this.CSG_Name = CSG_Name;
		this.SCName = SCName;
		this.TTL = TTL;
	}
	public Query(String CSG_Name, String SCName,String destination, String signature, String QueryString, String requestor){		
		destinatedAddress = destination;
		querySignature = signature;
		queryString = QueryString;
		requestorAddress = requestor;
		this.CSG_Name = CSG_Name;
		this.SCName = SCName;
	}
/*	public Query(String destination, String signature, String QueryString, String requestor){		
		destinatedAddress = destination;
		querySignature = signature;
		queryString = QueryString;
		requestorAddress = requestor;		
	}

	public Query(String destination, String signature, String QueryString, String requestor, int TTL){		
		destinatedAddress = destination;
		querySignature = signature;
		queryString = QueryString;
		requestorAddress = requestor;
		this.TTL = TTL;
	}
	*/
	public String toString(){
		String result = "<Query>";
		result += "  <Destinated Address> "+ destinatedAddress+" </Destinated Address>";
		result += "\n";
		result += "  <Query Signature> ";		
		result += querySignature;		
		result += "  </Query Signature>";
		result += "\n";
		result += "  <Query Content> "+ queryString+" </Query Content>";
		result += "\n";
		result += "  <Requestor> "+ requestorAddress+" </Requestor>";
		result += "\n";
		result += "  <TTL> "+ TTL+" </TTL>";
		result += "\n";
		result+="</Query>";
		result += "\n";
		return result;
	}
	
}
